package observer.usejava;

import observer.main.Observer;
import observer.main.Subject;

import java.util.ArrayList;
import java.util.List;
import java.util.Observable;

/**
 * 销售管理系统
 * observer.main
 * 气象站 主题 ，使用Java内置的观察者模式
 * 2018/8/3-16:02
 * 科达科技股份有限公司-版权所有
 * Created by wuqiang on 16:02.
 */
public class WeatherData extends Observable {

    private Double temperature; //温度
    private Double humidity;//湿度
    private Double pressure;//压强

    /**
     * 更新 数据
     * @param temperature
     * @param humidity
     * @param pressure
     */
    public void setMeasurements(Double temperature,Double humidity,Double pressure){
        //先更新自身数据
        setTemperature(temperature);
        setHumidity(humidity);
        setPressure(pressure);
        setChanged();
        notifyObservers();//通知所有观察者
    }

    public Double getTemperature() {
        return temperature;
    }

    public void setTemperature(Double temperature) {
        this.temperature = temperature;
    }

    public Double getHumidity() {
        return humidity;
    }

    public void setHumidity(Double humidity) {
        this.humidity = humidity;
    }

    public Double getPressure() {
        return pressure;
    }

    public void setPressure(Double pressure) {
        this.pressure = pressure;
    }
}
